package com.anan;
import java.util.Scanner;
public class A {
    public static void main(String[] args) {
        int []arr={12,23,45,64,89,239};
        int index=-1;
        Scanner x=new Scanner(System.in);
        System.out.println("请输入要加入的数字：");
        int newnum=x.nextInt();
        int[] newarr=new int[arr.length+1];
        for(int i=0;i<arr.length;i++){
            if(newnum<=arr[i]){
                index=i;
                break;
            }
        }
        if(index==-1){
            index=arr.length;
        }
        for(int i=0,j=0;i<arr.length+1;i++){
            if(i!=index){
                newarr[i]=arr[j];
                j++;
            }
            else{
                newarr[i]=newnum;
            }
        }
      arr=newarr;
        for (int i = 0; i <arr.length ; i++) {
            System.out.print(arr[i]+" ");
        }


    }
}
